import React from 'react';
import { Modal, Button } from 'antd';
import { connect } from 'dva';
import PateoTable from '../common/PateoTable';

@connect(state => ({
  extendForm: state.extendForm,
  vehicle: state.vehicle,
}))
export default class VersionHistoryModal extends React.PureComponent {
  render() {
    const { list, visible, loading, changeVisible } = this.props;
    const columns=[{
      title:'版本号',
      dataIndex:'currentVersion',
    }, {
      title:'更新时间',
      dataIndex:'createDt',
    }];
    const tableProps = {
      columns, // 列
      rowKey: record => record.sid, // key
      loading: loading, // 控制加载
      bordered: true, // 边框
      dataSource: list, // 远程数据
      scroll:{x: 'max-content'},
      pagination:false
    };
    return (
      <Modal
        title="软件升级记录"
        width="35%"
        visible={visible}
        closable
        onCancel={() => changeVisible()}
        maskClosable
        footer={<Button type="primary" onClick={() => changeVisible()}>返回</Button>}
      >
        <PateoTable
          tableProps={tableProps}
        />
      </Modal>
    );
  }
}
